package com.rabbitmq.demo.mq;

import com.rabbitmq.demo.pojo.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author :wn
 * @program : demo
 * @descript :
 * @create :2021-05-08 10:36
 */
@Component
public class ObjectSender {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(User user) {
        System.out.println("Sender object : " + user.toString());
        this.amqpTemplate.convertAndSend("objectQueue", user);
    }
}
